<%-- 
    Document   : register
    Created on : Mar 14, 2014, 8:23:40 PM
    Author     : ahmed
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="header.jsp" %>
        <script type="text/javascript">
            function validateForm() {
                document.getElementById("idName").innerHTML = "";
                document.getElementById("idEmail").innerHTML = "";
                document.getElementById("idPass").innerHTML = "";
                document.getElementById("idCredit").innerHTML = "";

                var x = document.getElementById("name").value;
                if (x == null || x == "") {
                    document.getElementById("idName").innerHTML = "*Enter your name";
                    return false;
                }

                var x = document.getElementById("email").value;
                if (x == null || x == "") {
                    document.getElementById("idEmail").innerHTML = "*Enter a valid e-mail address";
                    return false;
                }

                var x = document.getElementById("pass").value;
                if (x == null || x == "") {
                    document.getElementById("idPass").innerHTML = "*Enter a password";
                    return false;
                }
                
                var x = document.getElementById("balance").value;
                if (x == null || x == "") {
                    document.getElementById("idCredit").innerHTML = "*Enter your balance";
                    return false;
                }

                return true;
            }
        </script>
                    <div id="errorDiv">
                        <%
                            if (request.getAttribute("error") != null) {
                                out.println(request.getAttribute("error"));
                            }
                        %>
                    </div>
                    <form id="idForm" method="post" action="Register" onsubmit = "return validateForm()">
                        <pre>
                        <label>Name*      : </label><input type="text" name="name" id="name"><div id="idName"></div><br><br>
                        <label>Email*     : </label><input type="email" name="email" id="email"><div id="idEmail"></div><br><br>
                        <label>Password*  : </label><input type="password" name="pass" id="pass"><div id="idPass"></div><br><br>
                        <label>Job        : </label><input type="text" name="job"><br><br>
                        <label>Address    : </label><input type="text" name="address"><br><br>
                        <label>Birth Date : </label><input type="date" name="date"><br><br>
                        <label>Credit*    : </label><input type="number" name="balance" id="balance"><div id="idCredit"></div><br><br>
                        <input type="submit" value="Sign Up" name="subbmitButton">                        
                        </pre>
                    </form>
<%@include file="footer.jsp" %>